package com.snmp.smn.pdu;

public class PDUFactory {
	
	public static String SNMP_VERSION = "0";

	public static byte[] createHeartBeatRequestPDU() {
		return GetRequestPDU.getHeartBeatPDU().getBytes();
	}
	
	public static byte[] createHeartBeatResponsePDU() {
		return GetResponsePDU.getHeartBeatPDU().getBytes();
	}
	
	public static byte[] createSetRequestPDU(String command) {
		return SetRequestPDU.getSetRequestPDU(command).getBytes();
	}
	
	public static byte[] createISTrapPDU() {
		return TrapPDU.getTrapPDU("IS").getBytes();
	}
	
	public static byte[] createFileInfoRequestPDU(String fileName) {
		return GetRequestPDU.getFileInfoPDU(fileName).getBytes();
	}
	
	public static byte[] createFileContentRequestPDU(String fileName, int i) {
		return GetRequestPDU.getFileContentPDU(fileName, ""+i).getBytes();
	}
	
	public static byte[] createFileInfoResponsePDU(int size) {
		return GetResponsePDU.getFileInfoPDU(""+size).getBytes();
	}

	public static byte[] createFileInfoErrorResponsePDU() {
		return GetResponsePDU.getFileInfoPDU("Error: File Not Found").getBytes();
	}

	public static byte[] createFileContentResponsePDU(byte b) {
		byte[] bb = GetResponsePDU.getFileInfoPDU("").getBytes();
		byte[] result = new byte[bb.length + 1];
		
		for (int i=0; i<bb.length; i++) result[i] = bb[i];
		result[bb.length] = b;
		
		return result;
	}
}
